//
//  xuandizhiViewController.m
//  基本框架
//
//  Created by runone02 on 2018/8/23.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "xuandizhiViewController.h"
#import "CityViewController.h"
@interface xuandizhiViewController ()

@property (nonatomic, strong) UIButton *cityBtn;
@end

@implementation xuandizhiViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadCity];
    [self setupNavView];
}

- (void)setupNavView{
    [self.navView.leftButton setTitle:@"返回" forState:UIControlStateNormal];
    [self.navView.centerButton setTitle:@"选择" forState:UIControlStateNormal];
}


- (void)loadCity{
    self.cityBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.cityBtn setTitle:@"选择城市" forState:UIControlStateNormal];
    [self.cityBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.cityBtn.titleLabel.font = TITLE_FONT(30);
    [self.cityBtn addTarget:self action:@selector(cityBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.cityBtn];
    [self.cityBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.centerX.mas_equalTo(self.view);
        make.width.height.mas_equalTo(200);
    }];
}

- (void)cityBtnClick:(UIButton *)btn{
    WeakSelf(weakSelf);
    CityViewController *controller = [[CityViewController alloc] init];
    //定位城市
    controller.currentCityString = @"定位城市";
    controller.selectString = ^(NSString *string){

        [weakSelf.cityBtn setTitle:string forState:UIControlStateNormal];
    };
    [self presentViewController:controller animated:YES completion:nil];
}
@end
